#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<glob.h>

int main(int argc,char **argv){

    glob_t globres;
    int res,i,count=0;
    res = glob("/etc/pa*",0,NULL,&globres);
    if(res){
        perror("出错了");
        exit(0);
    }
    for (i = 0; i< globres.gl_pathc;i++)
    {
        printf(" %s \n",globres.gl_pathv[i]);
        count++;
    }

    printf(" 共%d个文件 \n",count);
    
   



   return 0;
}